Skip to content

test: add NA, empty string, and mixed whitespace tests for str_trim/str_squish#606

Closed
LeonidasZhak wants to merge 1 commit into
tidyverse:mainfrom
LeonidasZhak:tests/trim-na-empty-whitespace
Closed

test: add NA, empty string, and mixed whitespace tests for str_trim/str_squish#606
LeonidasZhak wants to merge 1 commit into
tidyverse:mainfrom
LeonidasZhak:tests/trim-na-empty-whitespace

Conversation

@LeonidasZhak

Copy link
Copy Markdown

Summary

Adds edge-case test coverage for str_trim() and str_squish():

  • NA handling: Tests that both functions correctly propagate NA values (single and mixed with non-NA)
  • Empty strings: Tests behavior with empty strings and whitespace-only strings
  • Mixed whitespace: Tests str_squish() with newlines (\n), carriage returns (\r\n), tabs (\t), and combinations

Motivation

These edge cases are important for data cleaning workflows where inputs commonly contain NAs, empty strings, and mixed whitespace characters. The tests ensure consistent behavior and guard against regressions.

Tests run

[ FAIL 0 | WARN 0 | SKIP 0 | PASS 27 ]

All 27 tests pass, including the 5 new test blocks (30 assertions).

…tr_squish

Add edge-case tests for data cleaning scenarios:
- NA passthrough in str_trim (all side variants) and str_squish
- Empty string and whitespace-only string handling
- Newlines, CRLF, and mixed whitespace in str_squish

The DESCRIPTION promises consistent NA handling but these cases
were untested. str_trunc has analogous NA tests (test-trunc.R:1-10).
@LeonidasZhak

Copy link
Copy Markdown
Author

Withdrawing this small automated PR while I consolidate an oversized batch of contributions and reduce maintainer review burden. Sorry for the noise, and thank you for maintaining the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant